lib, zebra: Add ability to read kernel notice of Offload Failed

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>
This commit is contained in:
Donald Sharp 2020-10-26 08:46:57 -04:00
parent 57df06840a
commit 0d32fbee6d
3 changed files with 13 additions and 1 deletions

View 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;

View 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) {

View 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);