Skip to content

Commit 6fd646b

Browse files
lucassdiassdceara
authored andcommitted
northd: Use uuid hash from source of parsed route.
Search by parsed route can be direct using uuid hash from source (static route, learned route, connect route), this avoids the search by ovn_datapath, and after, the search for parsed route. Signed-off-by: Lucas Vargas Dias <lucas.vdias@magalu.cloud> Signed-off-by: Dumitru Ceara <dceara@redhat.com> (cherry picked from commit 655f7bf)
1 parent 3a1dda9 commit 6fd646b

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

northd/en-learned-route-sync.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,9 @@ routes_table_sync(
235235

236236
static struct parsed_route *
237237
find_learned_route(const struct sbrec_learned_route *learned_route,
238-
const struct ovn_datapaths *lr_datapaths,
239238
const struct hmap *routes)
240239
{
241-
const struct ovn_datapath *od = ovn_datapath_from_sbrec(
242-
NULL, &lr_datapaths->datapaths, learned_route->datapath);
243-
if (!od) {
244-
return NULL;
245-
}
246-
return parsed_route_lookup_by_source(od, ROUTE_SOURCE_LEARNED,
240+
return parsed_route_lookup_by_source(ROUTE_SOURCE_LEARNED,
247241
&learned_route->header_, routes);
248242
}
249243

@@ -278,8 +272,7 @@ learned_route_sync_sb_learned_route_change_handler(struct engine_node *node,
278272

279273
if (sbrec_learned_route_is_deleted(changed_route)) {
280274
struct parsed_route *route = find_learned_route(
281-
changed_route, &northd_data->lr_datapaths,
282-
&data->parsed_routes);
275+
changed_route, &data->parsed_routes);
283276
if (!route) {
284277
goto fail;
285278
}

northd/northd.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11230,6 +11230,10 @@ parsed_route_lookup(struct hmap *routes, size_t hash,
1123011230
continue;
1123111231
}
1123211232

11233+
if (pr->od != new_pr->od) {
11234+
continue;
11235+
}
11236+
1123311237
return pr;
1123411238
}
1123511239

@@ -11297,15 +11301,14 @@ parsed_route_clone(const struct parsed_route *pr)
1129711301
return new_pr;
1129811302
}
1129911303

11300-
/* Searches for a parsed_route in a hmap based on datapath, source and
11304+
/* Searches for a parsed_route in a hmap based on source and
1130111305
* source_hint. */
1130211306
struct parsed_route *
11303-
parsed_route_lookup_by_source(const struct ovn_datapath *od,
11304-
enum route_source source,
11307+
parsed_route_lookup_by_source(enum route_source source,
1130511308
const struct ovsdb_idl_row *source_hint,
1130611309
const struct hmap *routes)
1130711310
{
11308-
size_t hash = uuid_hash(&od->key);
11311+
size_t hash = uuid_hash(&source_hint->uuid);
1130911312
struct parsed_route *route;
1131011313
HMAP_FOR_EACH_WITH_HASH (route, key_node, hash, routes) {
1131111314
if (route->source == source &&
@@ -11322,7 +11325,7 @@ parsed_route_lookup_by_source(const struct ovn_datapath *od,
1132211325
* This is distinct from route_hash which is stored in parsed_route->hash. */
1132311326
size_t
1132411327
parsed_route_hash(const struct parsed_route *pr) {
11325-
return uuid_hash(&pr->od->key);
11328+
return uuid_hash(&pr->source_hint->uuid);
1132611329
}
1132711330

1132811331
void

northd/northd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,8 @@ struct parsed_route {
825825

826826
struct parsed_route *parsed_route_clone(const struct parsed_route *);
827827
struct parsed_route *parsed_route_lookup_by_source(
828-
const struct ovn_datapath *od, enum route_source source,
829-
const struct ovsdb_idl_row *source_hint, const struct hmap *routes);
828+
enum route_source source, const struct ovsdb_idl_row *source_hint,
829+
const struct hmap *routes);
830830
size_t parsed_route_hash(const struct parsed_route *);
831831
void parsed_route_free(struct parsed_route *);
832832

0 commit comments

Comments
 (0)