Skip to content

Commit

Permalink
link: add HSR customizable nft, lci and ai timers support
Browse files Browse the repository at this point in the history
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 <gala 'underline' dragos 'at' yahoo 'dot' com>
  • Loading branch information
Dragos GALALAE committed Jun 11, 2024
1 parent d0ce70c commit c65005f
Showing 1 changed file with 111 additions and 111 deletions.
222 changes: 111 additions & 111 deletions lib/route/link/hsr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c65005f

Please sign in to comment.