diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2019-11-04 11:36:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-04 11:15:27 -0800 |
commit | 5d1fcaf35d74b4188d238e46f0be37c14a01f169 (patch) | |
tree | 55b357200a6a8666ee62f738ebb7508e1771d7cd /net/bridge/br_input.c | |
parent | 1574cf83c7a069f5f29295170ed8a568ccebcb7b (diff) |
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 'net/bridge/br_input.c')
-rw-r--r-- | net/bridge/br_input.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index f37b05090f45..8944ceb47fe9 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -182,6 +182,7 @@ static void __br_handle_local_finish(struct sk_buff *skb) /* check if vlan is allowed, to avoid spoofing */ if ((p->flags & BR_LEARNING) && + nbp_state_should_learn(p) && !br_opt_get(p->br, BROPT_NO_LL_LEARN) && br_should_learn(p, skb, &vid)) br_fdb_update(p->br, p, eth_hdr(skb)->h_source, vid, 0); |