diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2019-11-04 10:36:51 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-04 20:15:27 +0100 |
commit | 5d1fcaf35d74b4188d238e46f0be37c14a01f169 (patch) | |
tree | 55b357200a6a8666ee62f738ebb7508e1771d7cd /net/bridge/br_private.h | |
parent | Merge tag 'mlx5-updates-2019-11-01' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
download | linux-5d1fcaf35d74b4188d238e46f0be37c14a01f169.tar.xz linux-5d1fcaf35d74b4188d238e46f0be37c14a01f169.zip |
net: bridge: fdb: eliminate extra port state tests from fast-path
When commit df1c0b8468b3 ("[BRIDGE]: Packets leaking out of
disabled/blocked ports.") introduced the port state tests in
br_fdb_update() it was to avoid learning/refreshing from STP BPDUs, it was
also used to avoid learning/refreshing from user-space with NTF_USE. Those
two tests are done for every packet entering the bridge if it's learning,
but for the fast-path we already have them checked in br_handle_frame() and
is unnecessary to do it again. Thus push the checks to the unlikely cases
and drop them from br_fdb_update(), the new nbp_state_should_learn() helper
is used to determine if the port state allows br_fdb_update() to be called.
The two places which need to do it manually are:
- user-space add call with NTF_USE set
- link-local packet learning done in __br_handle_local_finish()
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/bridge/br_private.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 08742bff9bf0..36b0367ca1e0 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -500,6 +500,11 @@ static inline bool br_vlan_should_use(const struct net_bridge_vlan *v) return true; } +static inline bool nbp_state_should_learn(const struct net_bridge_port *p) +{ + return p->state == BR_STATE_LEARNING || p->state == BR_STATE_FORWARDING; +} + static inline int br_opt_get(const struct net_bridge *br, enum net_bridge_opts opt) { |