forked from Mirror/frr
zebra: rework affinity-map update hook
Don't use config tree when updating internal daemon state. Everything needed is already stored in internal structures. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
3856ba2359
commit
a3bbe28e6d
|
@ -30,37 +30,22 @@ static void zebra_affinity_map_update(const char *affmap_name, uint16_t old_pos,
|
||||||
uint16_t new_pos)
|
uint16_t new_pos)
|
||||||
{
|
{
|
||||||
struct if_link_params *iflp;
|
struct if_link_params *iflp;
|
||||||
enum affinity_mode aff_mode;
|
|
||||||
char xpath[XPATH_MAXLEN];
|
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
||||||
FOR_ALL_INTERFACES (vrf, ifp) {
|
FOR_ALL_INTERFACES (vrf, ifp) {
|
||||||
snprintf(xpath, sizeof(xpath),
|
|
||||||
"/frr-interface:lib/interface[name='%s']",
|
|
||||||
ifp->name);
|
|
||||||
if (!yang_dnode_exists(running_config->dnode, xpath))
|
|
||||||
continue;
|
|
||||||
snprintf(
|
|
||||||
xpath, sizeof(xpath),
|
|
||||||
"/frr-interface:lib/interface[name='%s']/frr-zebra:zebra/link-params/affinities[affinity='%s']",
|
|
||||||
ifp->name, affmap_name);
|
|
||||||
if (!yang_dnode_exists(running_config->dnode, xpath))
|
|
||||||
continue;
|
|
||||||
aff_mode = yang_dnode_get_enum(
|
|
||||||
running_config->dnode,
|
|
||||||
"/frr-interface:lib/interface[name='%s']/frr-zebra:zebra/link-params/affinity-mode",
|
|
||||||
ifp->name);
|
|
||||||
iflp = if_link_params_get(ifp);
|
iflp = if_link_params_get(ifp);
|
||||||
if (aff_mode == AFFINITY_MODE_EXTENDED ||
|
if (!iflp)
|
||||||
aff_mode == AFFINITY_MODE_BOTH) {
|
continue;
|
||||||
|
if (IS_PARAM_SET(iflp, LP_EXTEND_ADM_GRP) &&
|
||||||
|
admin_group_get(&iflp->ext_admin_grp, old_pos)) {
|
||||||
admin_group_unset(&iflp->ext_admin_grp,
|
admin_group_unset(&iflp->ext_admin_grp,
|
||||||
old_pos);
|
old_pos);
|
||||||
admin_group_set(&iflp->ext_admin_grp, new_pos);
|
admin_group_set(&iflp->ext_admin_grp, new_pos);
|
||||||
}
|
}
|
||||||
if (aff_mode == AFFINITY_MODE_STANDARD ||
|
if (IS_PARAM_SET(iflp, LP_ADM_GRP) &&
|
||||||
aff_mode == AFFINITY_MODE_BOTH) {
|
(iflp->admin_grp & (1 << old_pos))) {
|
||||||
iflp->admin_grp &= ~(1 << old_pos);
|
iflp->admin_grp &= ~(1 << old_pos);
|
||||||
if (new_pos < 32)
|
if (new_pos < 32)
|
||||||
iflp->admin_grp |= 1 << new_pos;
|
iflp->admin_grp |= 1 << new_pos;
|
||||||
|
|
Loading…
Reference in a new issue