On 6/13/26 12:20 AM, Dumitru Ceara wrote:
> On 6/11/26 11:06 PM, Lucas Vargas Dias wrote:
>> 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 <[email protected]>
>> ---
>
> Hi Lucas,
>
Hi again,
>> northd/en-learned-route-sync.c | 11 ++---------
>> northd/northd.c | 15 +++++++++------
>> northd/northd.h | 4 ++--
>> 3 files changed, 13 insertions(+), 17 deletions(-)
>>
>> diff --git a/northd/en-learned-route-sync.c b/northd/en-learned-route-sync.c
>> index 81ed81d3d..cbd516b68 100644
>> --- a/northd/en-learned-route-sync.c
>> +++ b/northd/en-learned-route-sync.c
>> @@ -230,15 +230,9 @@ routes_table_sync(
>>
>> static struct parsed_route *
>> find_learned_route(const struct sbrec_learned_route *learned_route,
>> - const struct ovn_datapaths *lr_datapaths,
>> const struct hmap *routes)
>> {
>> - const struct ovn_datapath *od = ovn_datapath_from_sbrec_(
>> - &lr_datapaths->datapaths, learned_route->datapath);
>> - if (!od) {
>> - return NULL;
>> - }
>> - return parsed_route_lookup_by_source(od, ROUTE_SOURCE_LEARNED,
>> + return parsed_route_lookup_by_source(ROUTE_SOURCE_LEARNED,
>> &learned_route->header_, routes);
>> }
>>
>> @@ -273,8 +267,7 @@
>> learned_route_sync_sb_learned_route_change_handler(struct engine_node *node,
>>
>> if (sbrec_learned_route_is_deleted(changed_route)) {
>> struct parsed_route *route = find_learned_route(
>> - changed_route, &northd_data->lr_datapaths,
>> - &data->parsed_routes);
>> + changed_route, &data->parsed_routes);
>> if (!route) {
>> goto fail;
>> }
>> diff --git a/northd/northd.c b/northd/northd.c
>> index 0dbf17426..99aaa19df 100644
>> --- a/northd/northd.c
>> +++ b/northd/northd.c
>> @@ -12177,6 +12177,10 @@ parsed_route_lookup(struct hmap *routes, size_t
>> hash,
>> continue;
>> }
>>
>> + if (pr->od != new_pr->od) {
>> + continue;
>> + }
>> +
>> return pr;
>> }
>>
>> @@ -12249,15 +12253,14 @@ parsed_route_clone(const struct parsed_route *pr)
>> return new_pr;
>> }
>>
>> -/* Searches for a parsed_route in a hmap based on datapath, source and
>> +/* Searches for a parsed_route in a hmap based on source and
>> * source_hint. */
>> struct parsed_route *
>> -parsed_route_lookup_by_source(const struct ovn_datapath *od,
>> - enum route_source source,
>> +parsed_route_lookup_by_source(enum route_source source,
>> const struct ovsdb_idl_row *source_hint,
>> const struct hmap *routes)
>> {
>> - size_t hash = uuid_hash(&od->key);
>> + size_t hash = uuid_hash(&source_hint->uuid);
>> struct parsed_route *route;
>> HMAP_FOR_EACH_WITH_HASH (route, key_node, hash, routes) {
>> if (route->source == source &&
>> @@ -12271,10 +12274,10 @@ parsed_route_lookup_by_source(const struct
>> ovn_datapath *od,
>>
>> /* This hash needs to be equal to the one used in
>> * build_route_flows_for_lrouter to iterate over all routes of a datapath.
>> - * This is distinct from route_hash which is stored in parsed_route->hash.
>> */
>> + * This is equal to route_hash which is stored in parsed_route->hash. */
Actually this comment change is not correct anymore, the hashes are
still different (in v3).
>> size_t
>> parsed_route_hash(const struct parsed_route *pr) {
>> - return uuid_hash(&pr->od->key);
>> + return uuid_hash(&pr->source_hint->uuid);
>> }
>>
>> void
>> diff --git a/northd/northd.h b/northd/northd.h
>> index 74fb58848..726a416e4 100644
>> --- a/northd/northd.h
>> +++ b/northd/northd.h
>> @@ -862,8 +862,8 @@ struct parsed_route {
>>
>> struct parsed_route *parsed_route_clone(const struct parsed_route *);
>> struct parsed_route *parsed_route_lookup_by_source(
>> - const struct ovn_datapath *od, enum route_source source,
>> - const struct ovsdb_idl_row *source_hint, const struct hmap *routes);
>> + enum route_source source, const struct ovsdb_idl_row *source_hint,
>> + const struct hmap *routes);
>> size_t parsed_route_hash(const struct parsed_route *);
>> void parsed_route_free(struct parsed_route *);
>>
>
> This looks good to me:
>
> Acked-by: Dumitru Ceara <[email protected]>
>
I fixed up the comment above and applied the patch to main, 26.03, 25.09
and 25.03.
Regards,
Dumitru
> Regards,
> Dumitru
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev