On 8/20/25 4:27 PM, Dima Chumak wrote: > On 2025-08-01 10:43 PM, Ilya Maximets wrote: >> External email: Use caution opening links or attachments >> >> >> On 7/23/25 3:12 PM, Dima Chumak via dev wrote: >>> Introduce support for route lookup across several routing tables >>> following a priority from highest to lowest. >>> >>> To properly prioritize route lookup order, the single router table in >>> OVS is now split into three tables: local, main and default. >>> Corresponding routing rules are created by default, where local table >>> has the highest priority and main and default tables have two lowest >>> priorities respectively. All non-standard tables can be added with a >>> priority in between local and main. >>> >>> Non-standard routing tables are created by reading the Routing Policy >> >> Why only the non-standard tables? >> >>> Database (RPDB) from the kernel, on systems that support it, and >>> importing only those tables which are referenced in the RPDB rules with >>> a table lookup action. The table IDs and rule priority are copied from >>> the kernel RPDB as is. >>> >>> Current implementation only supports RPDB rules with a source address >>> selector, in form of '[not] from IP' match. >>> >>> Signed-off-by: Dima Chumak <dchu...@nvidia.com> >>> --- >>> lib/ovs-router.c | 231 +++++++++++++++++++++++++++++------ >>> lib/ovs-router.h | 7 ++ >>> lib/packets.c | 20 +++ >>> lib/packets.h | 2 + >>> lib/route-table-bsd.c | 4 +- >>> lib/route-table-stub.c | 4 +- >>> lib/route-table.c | 225 ++++++++++++++++++++++++++++++++-- >>> lib/route-table.h | 18 ++- >>> tests/test-lib-route-table.c | 5 +- >>> 9 files changed, 465 insertions(+), 51 deletions(-) > > <snip> > >>> +bool >>> +ovs_router_is_referenced(uint32_t table) >>> +{ >>> + struct router_rule *rule; >>> + >>> + if (route_table_is_standard_id(table)) { >>> + return true; >>> + } >>> + >>> + PVECTOR_FOR_EACH (rule, &rules) { >>> + if (rule->lookup_table == table) { >>> + return true; >>> + } >>> + } >> >> A lookup in the hash map may be better here instead of iteration. >> > > If I understand it right, this would require a dedicated hash table to > store table IDs from the rule list. And the value stored would probably > be refcounted because one table can appear multiple times in the rule > list. I can add it as a follow up optimization change, what do you > think?
Can be a ccmap (counting cmap), I guess. I'd not expect to have a lot of rules, so maybe it's not needed after all. But let's see. Can surely be optimized later, if necessary. > > Alternatively, if we try to consult the clsmap hash to check if table > already exists it will prevent the logic in route_table_change() to work > correctly - a new table could never be synchronized from the kernel > because it would be considered as un-referenced. OK. > > Thanks, Dima > > <snip> _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev