From c65005f07711435653d27a5fe8b2233394450aac Mon Sep 17 00:00:00 2001 From: Dragos GALALAE Date: Tue, 11 Jun 2024 15:34:28 +0300 Subject: [PATCH] link: add HSR customizable nft, lci and ai timers support The following API is supported: - rtnl_hsr_get_nft(); - rtnl_hsr_set_nft(); - rtnl_hsr_get_lci(); - rtnl_hsr_set_lci(); - rtnl_hsr_get_ai(); - rtnl_hsr_set_ai(); Dissambiguation: nft - node forget time lci - lifecheck interval ai - announce interval Signed-off-by: Dragos Galalae --- lib/route/link/hsr.c | 222 +++++++++++++++++++++---------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/lib/route/link/hsr.c b/lib/route/link/hsr.c index b79608b4..35623997 100644 --- a/lib/route/link/hsr.c +++ b/lib/route/link/hsr.c @@ -236,117 +236,6 @@ static int hsr_put_attrs(struct nl_msg *msg, struct rtnl_link *link) return -NLE_MSGSIZE; } -/** - * Get Node Forget Time - * @arg link HSR link - * @arg nft node forget time - * - * @return 0 on success or a negative error code otherwise. - */ -int rtnl_hsr_get_nft(struct rtnl_link *link, uint32_t *nft) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - *nft = info->hi_nft; - - return 0; -} - -/** - * Set Node Forget Time for an HSR link - * @arg link HSR link - * @arg nft Node Forget Time (in ms) - * - * @return 0 on success or negative error code in case of an error - */ -int rtnl_hsr_set_nft(struct rtnl_link *link, uint32_t nft) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - info->hi_nft = nft; - info->hi_mask |= HSR_ATTR_NFT; - - return 0; -} - -/** - * Get Life Check Interval - * @arg link HSR link - * @arg lci life check interval - * - * @return 0 on success or a negative error code otherwise. - */ -int rtnl_hsr_get_lci(struct rtnl_link *link, uint32_t *lci) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - *lci = info->hi_lci; - - return 0; -} - -/** - * Set Life Check Interval for an HSR link - * @arg link HSR link - * @arg lci Life Check Interval (in ms) - * - * @return 0 on success or negative error code in case of an error - */ -int rtnl_hsr_set_lci(struct rtnl_link *link, uint32_t lci) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - info->hi_lci = lci; - info->hi_mask |= HSR_ATTR_LCI; - - return 0; -} - -/** - * Get Announce Interval - * @arg link HSR link - * @arg ai announce interval - * - * @return 0 on success or a negative error code otherwise. - */ -int rtnl_hsr_get_ai(struct rtnl_link *link, uint32_t *ai) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - *ai = info->hi_ai; - - return 0; -} - -/** - * Set Announce Interval for an HSR link - * @arg link HSR link - * @arg ai Announce Intercal (in ms) - * - * @return 0 on success or negative error code in case of an error - */ -int rtnl_hsr_set_ai(struct rtnl_link *link, uint32_t ai) -{ - struct hsr_info *info = link->l_info; - - IS_HSR_LINK_ASSERT(link); - - info->hi_ai = ai; - info->hi_mask |= HSR_ATTR_AI; - - return 0; -} - static void hsr_dump_line(struct rtnl_link *link, struct nl_dump_params *p) { nl_dump(p, "HSR/PRP : %s", link->l_name); @@ -667,6 +556,117 @@ int rtnl_hsr_set_op_mode(struct rtnl_link *link, uint32_t mode) return 0; } +/** + * Get Node Forget Time + * @arg link HSR link + * @arg nft node forget time + * + * @return 0 on success or a negative error code otherwise. + */ +int rtnl_hsr_get_nft(struct rtnl_link *link, uint32_t *nft) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + *nft = info->hi_nft; + + return 0; +} + +/** + * Set Node Forget Time for an HSR link + * @arg link HSR link + * @arg nft Node Forget Time (in ms) + * + * @return 0 on success or negative error code in case of an error + */ +int rtnl_hsr_set_nft(struct rtnl_link *link, uint32_t nft) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + info->hi_nft = nft; + info->hi_mask |= HSR_ATTR_NFT; + + return 0; +} + +/** + * Get Life Check Interval + * @arg link HSR link + * @arg lci life check interval + * + * @return 0 on success or a negative error code otherwise. + */ +int rtnl_hsr_get_lci(struct rtnl_link *link, uint32_t *lci) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + *lci = info->hi_lci; + + return 0; +} + +/** + * Set Life Check Interval for an HSR link + * @arg link HSR link + * @arg lci Life Check Interval (in ms) + * + * @return 0 on success or negative error code in case of an error + */ +int rtnl_hsr_set_lci(struct rtnl_link *link, uint32_t lci) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + info->hi_lci = lci; + info->hi_mask |= HSR_ATTR_LCI; + + return 0; +} + +/** + * Get Announce Interval + * @arg link HSR link + * @arg ai announce interval + * + * @return 0 on success or a negative error code otherwise. + */ +int rtnl_hsr_get_ai(struct rtnl_link *link, uint32_t *ai) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + *ai = info->hi_ai; + + return 0; +} + +/** + * Set Announce Interval for an HSR link + * @arg link HSR link + * @arg ai Announce Intercal (in ms) + * + * @return 0 on success or negative error code in case of an error + */ +int rtnl_hsr_set_ai(struct rtnl_link *link, uint32_t ai) +{ + struct hsr_info *info = link->l_info; + + IS_HSR_LINK_ASSERT(link); + + info->hi_ai = ai; + info->hi_mask |= HSR_ATTR_AI; + + return 0; +} + /** * Allocate link object of type HSR * @arg name (optional) name of the HSR link