diff mbox series

[ovs-dev,v2,1/8] route-table: Export is_standard_table_id().

Message ID 20250723131253.3704827-2-dchumak@nvidia.com
State Changes Requested
Delegated to: Ilya Maximets
Headers show
Series ovs-router: Multi-table routing infrastructure. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Dima Chumak July 23, 2025, 1:12 p.m. UTC
Make internal function is_standard_table_id() public to be used by the
next patches in the series.

Signed-off-by: Dima Chumak <dchumak@nvidia.com>
---
 lib/route-table-bsd.c  | 6 ++++++
 lib/route-table-stub.c | 6 ++++++
 lib/route-table.c      | 6 +++---
 lib/route-table.h      | 1 +
 4 files changed, 16 insertions(+), 3 deletions(-)

Comments

Ilya Maximets Aug. 1, 2025, 8:43 p.m. UTC | #1
On 7/23/25 3:12 PM, Dima Chumak via dev wrote:
> Make internal function is_standard_table_id() public to be used by the
> next patches in the series.
> 
> Signed-off-by: Dima Chumak <dchumak@nvidia.com>
> ---
>  lib/route-table-bsd.c  | 6 ++++++
>  lib/route-table-stub.c | 6 ++++++
>  lib/route-table.c      | 6 +++---
>  lib/route-table.h      | 1 +
>  4 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/route-table-bsd.c b/lib/route-table-bsd.c
> index 34d42cfab73b..a4eccb913916 100644
> --- a/lib/route-table-bsd.c
> +++ b/lib/route-table-bsd.c
> @@ -43,6 +43,12 @@ VLOG_DEFINE_THIS_MODULE(route_table_bsd);
>  #define RT_ROUNDUP(l) ((l) > 0 ? ROUND_UP((l), sizeof(long)) : sizeof(long))
>  #endif
>  
> +bool
> +route_table_is_standard_id(uint32_t table_id)
> +{
> +    return !table_id;
> +}
> +
>  bool
>  route_table_fallback_lookup(const struct in6_addr *ip6_dst, char name[],
>                              struct in6_addr *gw6)
> diff --git a/lib/route-table-stub.c b/lib/route-table-stub.c
> index dd0b096d4998..75e5bf37e3b5 100644
> --- a/lib/route-table-stub.c
> +++ b/lib/route-table-stub.c
> @@ -18,6 +18,12 @@
>  #include "ovs-router.h"
>  #include "route-table.h"
>  
> +bool
> +route_table_is_standard_id(uint32_t table_id)
> +{
> +    return !table_id;
> +}
> +
>  bool
>  route_table_fallback_lookup(const struct in6_addr *ip6_dst OVS_UNUSED,
>                              char name[] OVS_UNUSED,
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 2bbb51c08f7e..4b93339c93c9 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -519,8 +519,8 @@ route_table_parse(struct ofpbuf *buf, void *change)
>                                 nlmsg, rtm, NULL, change);
>  }
>  
> -static bool
> -is_standard_table_id(uint32_t table_id)
> +bool
> +route_table_is_standard_id(uint32_t table_id)

Do we even need this function in the route-table.c at all?

By the end of the set it is only used here for tracking default
tables as irrelevant while handling messages from the kernel.
But I'm not really sure why those are irrelevant?  And I'm not
sure why we're not re-dumping those tables when we get a rule
change pointing to them.

It seems to me like these checks should be removed and we only
need a variant of this function in the ovs-router module.
We only need a few build time assertions that RT_ and CLS_
definitions are the same.  That can be done here in the route
table module.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/route-table-bsd.c b/lib/route-table-bsd.c
index 34d42cfab73b..a4eccb913916 100644
--- a/lib/route-table-bsd.c
+++ b/lib/route-table-bsd.c
@@ -43,6 +43,12 @@  VLOG_DEFINE_THIS_MODULE(route_table_bsd);
 #define RT_ROUNDUP(l) ((l) > 0 ? ROUND_UP((l), sizeof(long)) : sizeof(long))
 #endif
 
+bool
+route_table_is_standard_id(uint32_t table_id)
+{
+    return !table_id;
+}
+
 bool
 route_table_fallback_lookup(const struct in6_addr *ip6_dst, char name[],
                             struct in6_addr *gw6)
diff --git a/lib/route-table-stub.c b/lib/route-table-stub.c
index dd0b096d4998..75e5bf37e3b5 100644
--- a/lib/route-table-stub.c
+++ b/lib/route-table-stub.c
@@ -18,6 +18,12 @@ 
 #include "ovs-router.h"
 #include "route-table.h"
 
+bool
+route_table_is_standard_id(uint32_t table_id)
+{
+    return !table_id;
+}
+
 bool
 route_table_fallback_lookup(const struct in6_addr *ip6_dst OVS_UNUSED,
                             char name[] OVS_UNUSED,
diff --git a/lib/route-table.c b/lib/route-table.c
index 2bbb51c08f7e..4b93339c93c9 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -519,8 +519,8 @@  route_table_parse(struct ofpbuf *buf, void *change)
                                nlmsg, rtm, NULL, change);
 }
 
-static bool
-is_standard_table_id(uint32_t table_id)
+bool
+route_table_is_standard_id(uint32_t table_id)
 {
     return !table_id
            || table_id == RT_TABLE_DEFAULT
@@ -533,7 +533,7 @@  route_table_change(struct route_table_msg *change, void *aux OVS_UNUSED)
 {
     if (!change
         || (change->relevant
-            && is_standard_table_id(change->rd.rta_table_id))) {
+            && route_table_is_standard_id(change->rd.rta_table_id))) {
         route_table_valid = false;
     }
     if (change) {
diff --git a/lib/route-table.h b/lib/route-table.h
index b805e84dd64c..5e060581fd25 100644
--- a/lib/route-table.h
+++ b/lib/route-table.h
@@ -162,6 +162,7 @@  bool route_table_fallback_lookup(const struct in6_addr *ip6_dst,
 typedef void route_table_handle_msg_callback(const struct route_table_msg *,
                                              void *aux);
 
+bool route_table_is_standard_id(uint32_t table_id);
 bool route_table_dump_one_table(uint32_t id,
                                 route_table_handle_msg_callback *,
                                 void *aux);