diff options
author | Jakub Urbańczyk <xthaid@gmail.com> | 2020-07-15 15:14:08 +0200 |
---|---|---|
committer | Jakub Urbańczyk <xthaid@gmail.com> | 2020-08-10 21:42:43 +0200 |
commit | 67e3369ed45ba18fa035e9aecf1477d98115f305 (patch) | |
tree | d1437909b904ff449fe3a6f73029c09ed0c6df1a /zebra/zebra_mpls_netlink.c | |
parent | zebra: add netlink message batching infrastructure (diff) | |
download | frr-67e3369ed45ba18fa035e9aecf1477d98115f305.tar.xz frr-67e3369ed45ba18fa035e9aecf1477d98115f305.zip |
zebra: netlink message batching
Integrate existing functions with batching infrastructure.
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
Diffstat (limited to 'zebra/zebra_mpls_netlink.c')
-rw-r--r-- | zebra/zebra_mpls_netlink.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/zebra/zebra_mpls_netlink.c b/zebra/zebra_mpls_netlink.c index c95a02163..742b08c37 100644 --- a/zebra/zebra_mpls_netlink.c +++ b/zebra/zebra_mpls_netlink.c @@ -28,13 +28,9 @@ #include "zebra/zebra_mpls.h" #include "zebra/kernel_netlink.h" -/* - * LSP forwarding update using dataplane context information. - */ -enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx) +static ssize_t netlink_lsp_msg_encoder(struct zebra_dplane_ctx *ctx, void *buf, + size_t buflen) { - uint8_t nl_pkt[NL_PKT_BUF_SIZE]; - ssize_t ret = -1; int cmd; /* Call to netlink layer based on type of update */ @@ -48,26 +44,39 @@ enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx) if (IS_ZEBRA_DEBUG_KERNEL || IS_ZEBRA_DEBUG_MPLS) zlog_debug("LSP in-label %u: update fails, no best NHLFE", dplane_ctx_get_in_label(ctx)); - goto done; + return -1; } cmd = RTM_NEWROUTE; } else /* Invalid op? */ - goto done; + return -1; - ret = netlink_mpls_multipath_msg_encode(cmd, ctx, nl_pkt, - sizeof(nl_pkt)); - if (ret <= 0) - return ZEBRA_DPLANE_REQUEST_FAILURE; + return netlink_mpls_multipath_msg_encode(cmd, ctx, buf, buflen); +} - ret = netlink_talk_info(netlink_talk_filter, (struct nlmsghdr *)nl_pkt, - dplane_ctx_get_ns(ctx), 0); +/* + * The communication with the kernel is done using the message batching + * interface, so return a failure. + */ +enum zebra_dplane_result kernel_lsp_update(struct zebra_dplane_ctx *ctx) +{ + return ZEBRA_DPLANE_REQUEST_FAILURE; +} -done: +enum netlink_msg_status netlink_put_lsp_update_msg(struct nl_batch *bth, + struct zebra_dplane_ctx *ctx) +{ + return netlink_batch_add_msg(bth, ctx, netlink_lsp_msg_encoder, false); +} - return (ret == 0 ? - ZEBRA_DPLANE_REQUEST_SUCCESS : ZEBRA_DPLANE_REQUEST_FAILURE); +/* + * The communication with the kernel is done using the message batching + * interface, so return a failure. + */ +enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx) +{ + return ZEBRA_DPLANE_REQUEST_FAILURE; } /* @@ -75,9 +84,10 @@ done: * but note that the default has been to report 'success' for pw updates * on unsupported platforms. */ -enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx) +enum netlink_msg_status netlink_put_pw_update_msg(struct nl_batch *bth, + struct zebra_dplane_ctx *ctx) { - return ZEBRA_DPLANE_REQUEST_SUCCESS; + return FRR_NETLINK_SUCCESS; } int mpls_kernel_init(void) |