]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, zebra: Add ability to read kernel notice of Offload Failed
authorDonald Sharp <sharpd@nvidia.com>
Mon, 26 Oct 2020 12:46:57 +0000 (08:46 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sun, 15 Nov 2020 15:12:50 +0000 (10:12 -0500)
The linux kernel is getting RTM_F_OFFLOAD_FAILED for kernel routes
that have failed to offload.  Write the code
to receive these notifications from the linux kernel
and store that data for display about the routes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/zclient.h
zebra/rt_netlink.c
zebra/zebra_vty.c

index 231fdad09badd34923d325d8505995bd1f7c12fe..3c80ba7efa5a9592f8ad942d7fcb028ac8081f41 100644 (file)
@@ -514,6 +514,13 @@ struct zapi_route {
  * offload situation.
  */
 #define ZEBRA_FLAG_OFFLOADED          0x100
+/*
+ * This flag tells everyone that the route has
+ * failed offloading.
+ * This flag makes no sense unless you are in an asic
+ * offload situation.
+ */
+#define ZEBRA_FLAG_OFFLOAD_FAILED     0x200
 
        /* The older XXX_MESSAGE flags live here */
        uint32_t message;
index 4dc8c2a6ebee29449c312431f27cf988e733826c..c0c1c4e7f26531dd48ff21b10d4b4827f56a3a62 100644 (file)
@@ -672,6 +672,8 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
                flags |= ZEBRA_FLAG_TRAPPED;
        if (rtm->rtm_flags & RTM_F_OFFLOAD)
                flags |= ZEBRA_FLAG_OFFLOADED;
+       if (rtm->rtm_flags & RTM_F_OFFLOAD_FAILED)
+               flags |= ZEBRA_FLAG_OFFLOAD_FAILED;
 
        /* Route which inserted by Zebra. */
        if (selfroute) {
index ab7d2845e73603c29c50d2bf37c1b62df60c2d2c..68487ea245549ff99621f4a53896a1925bc9d164 100644 (file)
@@ -209,7 +209,7 @@ static char re_status_output_char(const struct route_entry *re,
                        return 't';
 
                if (zrouter.asic_offloaded
-                   && !CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
+                   && CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))
                        return 'o';
 
                if (star_p)
@@ -870,6 +870,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
                if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
                        json_object_boolean_true_add(json_route, "offloaded");
 
+               if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED))
+                       json_object_boolean_false_add(json_route, "offloaded");
+
                if (re->tag)
                        json_object_int_add(json_route, "tag", re->tag);