]> git.baikalelectronics.ru Git - kernel.git/commit
net: flow_dissector: avoid indirect call to DSA .flow_dissect for generic case
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 26 Sep 2020 19:32:08 +0000 (22:32 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Sep 2020 21:17:59 +0000 (14:17 -0700)
commit056dd6bddbc8aae3b02185c9d5fd916d4acae319
tree1997e33e69b3cd5b2f839f68ab1ae536c39bb273
parent119df2574633329879f7d91234992cf07b8005d6
net: flow_dissector: avoid indirect call to DSA .flow_dissect for generic case

With the recent mitigations against speculative execution exploits,
indirect function calls are more expensive and it would be good to avoid
them where possible.

In the case of DSA, most switch taggers will shift the EtherType and
next headers by a fixed amount equal to that tag's length in bytes.
So we can use a generic procedure to determine that, without calling
into custom tagger code. However we still leave the flow_dissect method
inside struct dsa_device_ops as an override for the generic function.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/flow_dissector.c