Skip to content

Commit

Permalink
update set port locked
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Gorski <[email protected]>
  • Loading branch information
KanjiMonster committed Jan 16, 2025
1 parent 431df68 commit 602ae3c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/netlink/nl_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1200,24 +1200,16 @@ nl_bridge::get_port_vlan_stp_states(rtnl_link *link) {
}

void nl_bridge::set_port_locked(uint32_t port_id, bool locked) {
uint32_t learn_flags, move_flags;

if (locked) {
/* learn pending, but don't forward */
learn_flags = switch_interface::SAI_SRC_LEARN_ARL |
switch_interface::SAI_SRC_LEARN_CPU |
switch_interface::SAI_SRC_LEARN_PENDING;
sw->port_set_learn(port_id, switch_interface::SAI_SRC_LEARN_NOTIFICATION);
/* kernel does not allow roaming to locked ports, so just drop it */
move_flags = switch_interface::SAI_SRC_LEARN_NONE;
sw->port_set_move_learn(port_id, switch_interface::SAI_SRC_LEARN_DROP);
} else {
/* everything goes */
learn_flags = move_flags = switch_interface::SAI_SRC_LEARN_ARL |
switch_interface::SAI_SRC_LEARN_CPU |
switch_interface::SAI_SRC_LEARN_FWD |
switch_interface::SAI_SRC_LEARN_PENDING;
sw->port_set_learn(port_id, switch_interface::SAI_SRC_LEARN_HW_NOTIFICATION);
sw->port_set_move_learn(port_id, switch_interface::SAI_SRC_LEARN_HW_NOTIFICATION);
}

sw->port_set_learn(port_id, learn_flags, move_flags);
}

} /* namespace basebox */

0 comments on commit 602ae3c

Please sign in to comment.