Skip to content

Commit

Permalink
Merge branch 'kmuppalla/add_traces_in_zebra' into 'dev'
Browse files Browse the repository at this point in the history
zebra: Add lttng tp in evpn vni trans def gw event

 #

See merge request nbu-sws/CL/FRR/frr!659
  • Loading branch information
Karthikeya Venkat Muppalla committed Feb 20, 2024
2 parents b1cb735 + 84fb157 commit eff303f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
12 changes: 12 additions & 0 deletions tools/frr_babeltrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ def location_bgp_err_str(field_val):
return ("failed in bgp_accept")
elif field_val == 2:
return ("failed in bgp_connect")
def location_vni_transition(field_val):
if field_val == 1:
return ("Del L2-VNI - transition to L3-VNI")
elif field_val == 2:
return ("Adding L2-VNI - transition from L3-VNI");

def print_prefix_addr(field_val):
"""
Expand Down Expand Up @@ -857,6 +862,11 @@ def parse_frr_bgp_err_str(event):
parse_event(event, field_parsers)


def parse_frr_zebra_zebra_vxlan_handle_vni_transition(event):
field_parsers = {"location" : location_vni_transition}

parse_event(event, field_parsers)

############################ evpn parsers - end *#############################

def main():
Expand Down Expand Up @@ -985,6 +995,8 @@ def main():
parse_frr_zebra_netlink_intf_err,
"frr_bgp:bgp_err_str":
parse_frr_bgp_err_str,
"frr_zebra:zebra_vxlan_handle_vni_transition":
parse_frr_zebra_zebra_vxlan_handle_vni_transition,
}

# get the trace path from the first command line argument
Expand Down
47 changes: 47 additions & 0 deletions zebra/zebra_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,21 @@ TRACEPOINT_EVENT(

TRACEPOINT_LOGLEVEL(frr_zebra, zebra_vxlan_remote_vtep_add, TRACE_INFO)

TRACEPOINT_EVENT(
frr_zebra,
zebra_vxlan_remote_vtep_del,
TP_ARGS(
struct in_addr, vtep_ip,
vni_t, vni,
const char *, proto),
TP_FIELDS(
ctf_string(vtep_ip, inet_ntoa(vtep_ip))
ctf_integer(vni_t, vni, vni)
ctf_string(proto, proto)
)
)
TRACEPOINT_LOGLEVEL(frr_zebra, zebra_vxlan_remote_vtep_del, TRACE_INFO)

TRACEPOINT_EVENT(
frr_zebra,
zebra_nhg_install_kernel,
Expand Down Expand Up @@ -1857,6 +1872,38 @@ TRACEPOINT_EVENT(
)
TRACEPOINT_LOGLEVEL(frr_zebra, gr_last_route_re, TRACE_INFO)

/*
* 0: EVPN gateway macip advertise enabled
* 1: EVPN gateway macip advertise disabled
*/
TRACEPOINT_EVENT(
frr_zebra,
zebra_vxlan_advertise_gw_macip,
TP_ARGS(
int, advertise,
vni_t, vni,
int, curr_advertise_gw_macip),
TP_FIELDS(
ctf_integer(int, advertise, advertise)
ctf_integer(vni_t, vni, vni)
ctf_integer(int, curr_advertise_gw_macip, curr_advertise_gw_macip)
)
)
TRACEPOINT_LOGLEVEL(frr_zebra, zebra_vxlan_advertise_gw_macip, TRACE_INFO)

TRACEPOINT_EVENT(
frr_zebra,
zebra_vxlan_handle_vni_transition,
TP_ARGS(
vni_t, vni,
uint8_t, loc),
TP_FIELDS(
ctf_integer(vni_t, vni, vni)
ctf_integer(uint8_t, location, loc)
)
)
TRACEPOINT_LOGLEVEL(frr_zebra, zebra_vxlan_handle_vni_transition, TRACE_INFO)

/* clang-format on */
#include <lttng/tracepoint-event.h>

Expand Down
19 changes: 15 additions & 4 deletions zebra/zebra_vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,8 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni,
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Del L2-VNI %u - transition to L3-VNI", vni);

frrtrace(2, frr_zebra, zebra_vxlan_handle_vni_transition, vni,
1);
/* Delete EVPN from BGP. */
zebra_evpn_send_del_to_client(zevpn);

Expand Down Expand Up @@ -2495,6 +2497,9 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni,
zlog_debug("Adding L2-VNI %u - transition from L3-VNI",
vni);

frrtrace(2, frr_zebra, zebra_vxlan_handle_vni_transition, vni,
2);

/* Find VxLAN interface for this VNI. */
zns = zebra_ns_lookup(NS_DEFAULT);
for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) {
Expand Down Expand Up @@ -4763,11 +4768,14 @@ void zebra_vxlan_remote_vtep_del_zapi(ZAPI_HANDLER_ARGS)
STREAM_GETL(s, flood_control);
l += 4;

const char *client_proto_str =
zebra_route_string(client->proto);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Recv VTEP DEL %pI4 VNI %u from %s",
&vtep_ip, vni,
zebra_route_string(client->proto));
&vtep_ip, vni, client_proto_str);

frrtrace(3, frr_zebra, zebra_vxlan_remote_vtep_del, vtep_ip,
vni, client_proto_str);
/* Enqueue for processing */
zebra_rib_queue_evpn_rem_vtep_del(zvrf_id(zvrf), vni, vtep_ip);
}
Expand Down Expand Up @@ -5751,12 +5759,15 @@ void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS)
if (!zevpn)
return;

int curr_advertise_gw_macip = advertise_gw_macip_enabled(zevpn);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"EVPN gateway macip Adv %s on VNI %d , currently %s",
advertise ? "enabled" : "disabled", vni,
advertise_gw_macip_enabled(zevpn) ? "enabled"
: "disabled");
curr_advertise_gw_macip ? "enabled"
: "disabled");
frrtrace(3, frr_zebra, zebra_vxlan_advertise_gw_macip,
advertise, vni, curr_advertise_gw_macip);

if (zevpn->advertise_gw_macip == advertise)
return;
Expand Down

0 comments on commit eff303f

Please sign in to comment.